

package com.hazelcast.internal.ascii;

import com.hazelcast.internal.networking.OutboundFrame;
import com.hazelcast.internal.nio.ascii.TextDecoder;
import com.hazelcast.internal.nio.ascii.TextEncoder;

import java.nio.ByteBuffer;

public interface TextCommand extends OutboundFrame {

    TextCommandConstants.TextCommandType getType();

    void init(TextDecoder decoder, long requestId);

    TextDecoder getDecoder();

    TextEncoder getEncoder();

    long getRequestId();

    boolean shouldReply();

    boolean readFrom(ByteBuffer src);

    boolean writeTo(ByteBuffer dst);

    /**
     * Called from TextCommandService right before TextCommand is put to outboundQueue
     */
    default void beforeSendResponse(TextCommandService textCommandService) {

    }
}
